package com.jerome.election.enums;

/**
 * api url
 *
 * @author songxulin
 * @date 2023/11/1 20:54
 * @version 1.0
 */
public enum ApiUrlEnum {
    //clusters
    CLUSTERS("/clusters"),
    //leader
    LEADER("/leader"),
    //state
    STATE("/state"),
    ;

    public static ApiUrlEnum getByCode(String code){
        for (ApiUrlEnum value : ApiUrlEnum.values()) {
            if (code.equals(value.urlPath)){
                return value;
            }
        }
        return CLUSTERS;
    }

    private String urlPath;

    ApiUrlEnum(String code) {
        this.urlPath = code;
    }

    public String getCode() {
        return urlPath;
    }

    public void setCode(String code) {
        this.urlPath = code;
    }
}
